package com.qf.cx.simplenms.persist.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name = "Reader", uniqueConstraints = { @UniqueConstraint(columnNames = { "ip", "port" }),
		@UniqueConstraint(columnNames = { "deviceSn" }) })
public class ReaderEntity {
	@Id
	@Column(name = "name")
	private String name;
	@Column
	private String ip;
	@Column
	private int port;
	@Column
	private String deviceSn;
	@Column
	private int linkType;

	@OneToMany(targetEntity = AntennaEntity.class, fetch = FetchType.EAGER, cascade = {
			CascadeType.ALL }, orphanRemoval = true)
	private List<AntennaEntity> antennaEntities;

	public String getDeviceSn() {
		return deviceSn;
	}

	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}

	public int getLinkType() {
		return linkType;
	}

	public void setLinkType(int linkType) {
		this.linkType = linkType;
	}

	public List<AntennaEntity> getAntennaEntities() {
		return antennaEntities;
	}

	public void setAntennaEntities(List<AntennaEntity> antennaEntities) {
		this.antennaEntities = antennaEntities;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

}
